package Demo;

public class SilverCard extends Card {
    public SilverCard(String carID, String name, String phone, double money)
    {
        super(carID, name, phone, money);
    }

    @Override
    public void payMoney(double money) {
        System.out.println("使用银卡消费:" + money);
        System.out.println("优惠后的价格：" + money * 0.9);

        //判断余额是否足够
        if (getMoney() < money * 0.8) {
            System.out.println("余额不足，消费失败");
            return;
        }

        //更新卡余额
        setMoney(getMoney() - money * 0.9);
        System.out.println("当前余额：" + getMoney());
    }
}
